﻿namespace LS.Nc6.Web.Entry
{
    public class ResponseHelper
    {

        #region 提示消息 公用
        public const string NONEXISTENT = "记录不存在或已删除";

        public const string AUDIT_NONEXISTENT = "申请已被审批";

        /// <summary>
        /// 用于成功
        /// </summary>
        public const int SEUCCESSCODE = 0;

        /// <summary>
        /// 用于失败
        /// </summary>
        public const int FAILCODE = 1;

        #endregion

        #region 权限 相关
        /// <summary>
        /// 权限不足
        /// </summary>
        public const string PERMISSION_QXZU = "权限不足";

        /// <summary>
        /// 非法操作
        /// </summary>
        public const string PERMISSION_FFCZ = "非法操作";

        /// <summary>
        /// 无删除权限
        /// </summary>
        public const string PERMISSION_WSCQX = "无删除权限";

        /// <summary>
        /// 无删除权限
        /// </summary>
        public const string PERMISSION_WXGQX = "无修改权限";


        #endregion

        #region 操作 相关
        /// <summary>
        /// 数据已删除
        /// </summary>
        public const string OPERATE_SJYSC = "数据已删除";

        /// <summary>
        /// 用户名已被占用
        /// </summary>
        public const string OPERATE_YHMYBZY = "用户名已被占用";

        /// <summary>
        /// 用户名可用
        /// </summary>
        public const string OPERATE_YHMKY = "用户名可用";

        
        #endregion 

        #region 参数相关
        /// <summary>
        /// 参数错误
        /// </summary>
        public const string PARAMETER_CSCW = "参数错误";

        /// <summary>
        /// 编码已存在
        /// </summary>
        public const string PARAMETER_BMYCZ = "编码已存在";

        /// <summary>
        /// 编码已不能为空
        /// </summary>
        public const string PARAMETER_BMBNWK = "编码已不能为空";

        /// <summary>
        /// 密码和确认密码不能为空
        /// </summary>
        public const string PARAMETER_MYQRMABNWK = "密码和确认密码不能为空";

        /// <summary>
        /// 两次输入密码不一致
        /// </summary>
        public const string PARAMETER_MBBYZ = "两次输入密码不一致";

        /// <summary>
        /// 原密码错误
        /// </summary>
        public const string PARAMETER_YMMCW = "原密码错误";

        /// <summary>
        /// 头像图片Url为空
        /// </summary>
        public const string PARAMETER_TXDZBWK = "头像图片Url为空";

        /// <summary>
        /// 此账号未审核
        /// </summary>
        public const string PARAMETER_CZHWSH = "此账号未审核";

        /// <summary>
        /// 请输入通知内容
        /// </summary>
        public const string PARAMETER_NOTICEEMPTY = "请输入通知内容";

        /// <summary>
        /// 无法确定父栏目
        /// </summary>
        public const string PARAMETER_WFQDFLM= "无法确定父栏目";

        /// <summary>
        /// 无法确定内容对应的栏目
        /// </summary>
        public const string PARAMETER_WFQDNRDYDLM = "无法确定内容对应的栏目";

    
        #endregion

        #region  保存 删除  操作 提示消息
        /// <summary>
        /// 返回保存是否成功
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        public static ResponseResult SaveResult(long result)
        {
            if (result > 0)
            {
                return new ResponseResult { code = ResponseHelper.SEUCCESSCODE, message = "保存成功" };
            }
            else
            {
                return new ResponseResult { code = ResponseHelper.FAILCODE, message = "保存失败" };
            }
        }
        /// <summary>
        /// 操作是否成功
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        public static ResponseResult OperateResult(long result)
        {
            if (result > 0)
            {
                return new ResponseResult { code = ResponseHelper.SEUCCESSCODE, message = "操作成功" };
            }
            else
            {
                return new ResponseResult { code = ResponseHelper.FAILCODE, message = "操作失败" };
            }
        }
        /// <summary>
        /// 删除是否成功
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        public static ResponseResult DeleteResult(long result)
        {
            if (result > 0)
            {
                return new ResponseResult { code = ResponseHelper.SEUCCESSCODE, message = "删除成功" };
            }
            else
            {
                return new ResponseResult { code = ResponseHelper.FAILCODE, message = "删除失败" };
            }
        }

        /// <summary>
        /// 消息提示
        /// </summary>
        /// <param name="responseMsg"></param>
        /// <returns></returns>
        public static ResponseResult MessageResult(string responseMsg)
        {
            return new ResponseResult { code = ResponseHelper.FAILCODE, message = responseMsg };
        }

        #endregion

        
    }

    public class ResponseDataResult
    {
        public int code { get; set; }
        public string message { get; set; }

        public object data { get; set; }
    }

    public class ResponseResult
    {
        public int code { get; set; }
        public string message { get; set; }
    }

    public class ResponseResultDataList
    {
        public int code { get; set; }
        public string message { get; set; }

        public object data { get; set; }

        public int count { get; set; }
    }
}
